package demo02;

import java.util.Arrays;
import java.util.Random;

//定义一个数组，要求打乱数组中所有数据的顺序
public class HomeWork03 {
    public static void main(String[] args) {
        int [] arr={1,2,3,4,5};
        Random r=new Random();
        for (int i=0; i<arr.length;i++){
            int sc=r.nextInt(arr.length-1);
            int temp=arr[i];
            arr[i] =arr[sc];
            arr[sc] =temp;
        }
        System.out.print("{");
        for (int i=0;i<arr.length;i++){
            if(i==arr.length-1){
                System.out.print(arr[i]);
            }
            else{
                System.out.print(arr[i] + ",");
            }
        }
        System.out.print("}");
    }
}